﻿using mds.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace mds.HiveService
{
    internal class HiveConfigure
    {
        private static Dictionary<string, string> _hiveHostCollections = new Dictionary<string, string>();
        private static Dictionary<string, int> _hiveHostPortCollections = new Dictionary<string, int>();
        private static HiveConfigure _instance = new HiveConfigure();
        private HiveConfigure()
        {
            Init();
        }
        public static HiveConfigure Instance
        {
            get { return _instance; }
        }
        private void Init()
        {
            var config = ConfigurationAdapter.Instance.GetConfigItem<HiveHostConfigItem>("HiveService");
        }
        public string GetHostServer(string hostServerName)
        {
            if (_hiveHostCollections.ContainsKey(hostServerName))
            {
                return _hiveHostCollections[hostServerName];
            }
            return string.Empty;
        }
        public int GetHostPort(string hostServerName)
        {
            if (_hiveHostPortCollections.ContainsKey(hostServerName))
            {
                return _hiveHostPortCollections[hostServerName];
            }
            return -1;
        }
     

        public string GetDefaultHost()
        {
            return _hiveHostCollections["default"];
        }

        public int GetDefaultPort()
        {
            return _hiveHostPortCollections["default"];
        }
    }
}
